import 'dart:io';

import 'package:clean_app/asset/storage.dart';
import 'package:flutter/material.dart';

class FontSizeProvider extends ChangeNotifier {
  double fraction = 1;

  getFontScaleFrac() async {
    var tmp = await getStorage(
      key: "font_frac",
      initData: Platform.isAndroid ? "1.0" : "1.0",
    );
    fraction = double.parse(tmp);
    refresh();
  }

  setFontScaleFrac(double frac) async {
    fraction = frac;
    refresh();
    await setStorage(key: "font_frac", value: frac.toString());
  }

  refresh() {
    notifyListeners();
  }
}
